namespace Lays.Manage.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class UpdateNewsEntity_3 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.News", "NewsType_Id", "dbo.NewsTypes");
            DropIndex("dbo.News", new[] { "NewsType_Id" });
            RenameColumn(table: "dbo.News", name: "NewsType_Id", newName: "NewsTypeId");
            AlterColumn("dbo.News", "NewsTypeId", c => c.Int(nullable: false));
            CreateIndex("dbo.News", "NewsTypeId");
            AddForeignKey("dbo.News", "NewsTypeId", "dbo.NewsTypes", "Id", cascadeDelete: true);
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.News", "NewsTypeId", "dbo.NewsTypes");
            DropIndex("dbo.News", new[] { "NewsTypeId" });
            AlterColumn("dbo.News", "NewsTypeId", c => c.Int());
            RenameColumn(table: "dbo.News", name: "NewsTypeId", newName: "NewsType_Id");
            CreateIndex("dbo.News", "NewsType_Id");
            AddForeignKey("dbo.News", "NewsType_Id", "dbo.NewsTypes", "Id");
        }
    }
}
